/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2024-07-23
 * Time: 12:24
 */






class Slution {
    public int removeElement(int[] nums, int val) {
        int n = nums.length;
        int left = 0;
        for (int right = 0; right < n; right++) {
            if (nums[right] != val) {
                nums[left] = nums[right];
                left++;
            }
        }
        return left;
    }
}

public class Test {
    public static void main(String[] args) {
        Slution slution = new Slution();
        int[] arr = {5,8,7,0,9,3,5,6};
        int remve = slution.removeElement(arr,5);
        System.out.println(remve);
    }
}
